package com.dm.sort.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.dm.common.utils.DubboUtil;
import com.dm.dto.sort.DmItemInfo;
import com.dm.module.DmArea;
import com.dm.module.DmItemType;
import com.dm.sort.mapper.SortMapper;
import com.dm.sort.service.SortService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
@Service(version = DubboUtil.VERSION_1,group = DubboUtil.GROUP_NAME)
@Component
public class SortServiceImpl  implements SortService {

    @Autowired
    private SortMapper sortMapper;

    @Override
    public List<DmArea> getAll() {
        return sortMapper.getAll();
    }

    @Override
    public List<DmItemType> sortAll() {
        return sortMapper.sortAll();
    }

    @Override
    public PageInfo<DmItemInfo> listPage(int pageNum, int pageSize, Long areaId, Long itemType1Id) {
        PageHelper.startPage(pageNum,pageSize);
        List<DmItemInfo> l = sortMapper.listPage(areaId,itemType1Id);
        PageInfo<DmItemInfo> page = new  PageInfo<>(l);

        return page;
    }

}
